[IA64] Fix VTi domain creation
authorawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Tue, 5 Dec 2006 16:44:24 +0000 (09:44 -0700)
committerawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Tue, 5 Dec 2006 16:44:24 +0000 (09:44 -0700)
Signed-off-by: Zhang Xin <xing.z.zhang@intel.com>
tools/libxc/ia64/xc_ia64_hvm_build.c
tools/python/xen/lowlevel/xc/xc.c
xen/include/public/arch-ia64.h

index 325442b1b4449330fe5ee39fca0ebf01f548b908..a38728d73a956cb25c3481c90020595b5762757f 100644 (file)
@@ -591,6 +591,7 @@ setup_guest(int xc_handle, uint32_t dom, unsigned long memsize,
     unsigned long dom_memsize = ((memsize - 16) << 20);
     unsigned long nr_pages = (unsigned long)memsize << (20 - PAGE_SHIFT);
     unsigned long normal_pages = nr_pages - GFW_PAGES;
+    unsigned long vcpus;
     int rc;
     long i, j;
     DECLARE_DOMCTL;
@@ -668,7 +669,6 @@ setup_guest(int xc_handle, uint32_t dom, unsigned long memsize,
     if (xc_domctl(xc_handle, &domctl))
         goto error_out;
 
-
     // Load guest firmware 
     if (xc_ia64_copy_to_domain_pages(xc_handle, dom, image,
                             (GFW_START + GFW_SIZE - image_size) >> PAGE_SHIFT,
@@ -677,15 +677,17 @@ setup_guest(int xc_handle, uint32_t dom, unsigned long memsize,
         goto error_out;
     }
 
+    // Get number of vcpus, stored by pyxc_hvm_build()
+    xc_get_hvm_param(xc_handle, dom, HVM_PARAM_VCPUS, &vcpus);
+
     // Hand-off state passed to guest firmware 
-    if (xc_ia64_build_hob(xc_handle, dom, dom_memsize,
-                          (unsigned long)vcpus) < 0) {
+    if (xc_ia64_build_hob(xc_handle, dom, dom_memsize, vcpus) < 0) {
         PERROR("Could not build hob\n");
         goto error_out;
     }
 
     xc_set_hvm_param(xc_handle, dom,
-                     HVM_PARAM_STORE_PFN, STORE_PAGE_START>>PAGE_SHIFT);
+                     HVM_PARAM_STORE_PFN, pfn_list[nr_pages - 2]);
 
     // Retrieve special pages like io, xenstore, etc. 
     sp = (shared_iopage_t *)xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
index 2eb9376426f7857564d5df29211bf0e58353c88c..48f85aa9dce164b6d5832a4786cc25883eaa48e0 100644 (file)
@@ -374,10 +374,13 @@ static PyObject *pyxc_hvm_build(XcObject *self,
                                 PyObject *kwds)
 {
     uint32_t dom;
+#if !defined(__ia64__)
     struct hvm_info_table *va_hvm;
     uint8_t *va_map, sum;
+    int i;
+#endif
     char *image;
-    int i, store_evtchn, memsize, vcpus = 1, pae = 0, acpi = 0, apic = 1;
+    int store_evtchn, memsize, vcpus = 1, pae = 0, acpi = 0, apic = 1;
     unsigned long store_mfn;
 
     static char *kwd_list[] = { "domid", "store_evtchn",
@@ -388,9 +391,14 @@ static PyObject *pyxc_hvm_build(XcObject *self,
                                       &image, &vcpus, &pae, &acpi, &apic) )
         return NULL;
 
+#if defined(__ia64__)
+    /* Set vcpus to later be retrieved in setup_guest() */
+    xc_set_hvm_param(self->xc_handle, dom, HVM_PARAM_VCPUS, vcpus);
+#endif
     if ( xc_hvm_build(self->xc_handle, dom, memsize, image) != 0 )
         return PyErr_SetFromErrno(xc_error);
 
+#if !defined(__ia64__)
     /* Set up the HVM info table. */
     va_map = xc_map_foreign_range(self->xc_handle, dom, XC_PAGE_SIZE,
                                   PROT_READ | PROT_WRITE,
@@ -408,9 +416,12 @@ static PyObject *pyxc_hvm_build(XcObject *self,
         sum += ((uint8_t *)va_hvm)[i];
     va_hvm->checksum = -sum;
     munmap(va_map, XC_PAGE_SIZE);
+#endif
 
     xc_get_hvm_param(self->xc_handle, dom, HVM_PARAM_STORE_PFN, &store_mfn);
+#if !defined(__ia64__)
     xc_set_hvm_param(self->xc_handle, dom, HVM_PARAM_PAE_ENABLED, pae);
+#endif
     xc_set_hvm_param(self->xc_handle, dom, HVM_PARAM_STORE_EVTCHN,
                      store_evtchn);
 
index 8125eacebb5b51c4541d50b7f7a13d09626c4319..f3b8e423b5161965e8f379c17c8472c2dbe19ab7 100644 (file)
@@ -66,6 +66,13 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
 /* WARNING: before changing this, check that shared_info fits on a page */
 #define MAX_VIRT_CPUS 64
 
+/*
+ * HVM_PARAM_PAE_ENABLED is meaningless on ia64, so we overload this
+ * entry to store the number of vCPUs.  XXX Need arch-specific extentions
+ * for xc_get/set_hvm_param().
+ */
+#define HVM_PARAM_VCPUS    HVM_PARAM_PAE_ENABLED
+
 #ifndef __ASSEMBLY__
 
 typedef unsigned long xen_ulong_t;